import { createRouter, createWebHistory } from "vue-router";

//导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'
import AttendanceViewVue from '@/views/attendance/AttendanceView.vue'
import UserViewVue from '@/views/user/UserView.vue'
import UserEditVue from "@/views/user/UserEdit.vue";
import WorkBenchesVue from "@/views/workbenches/WorkBenches.vue";
import LeaveViewVue from "@/views/leave/LeaveView.vue";
import AttendanceHistoryViewVue from "@/views/attendancehistory/AttendanceHistoryView.vue";
import ExpenseViewVue from "@/views/expense/ExpenseView.vue";
import NoticeViewVue from "@/views/notice/NoticeView.vue";
import TaskViewVue from "@/views/task/TaskView.vue";
import MessagesViewVue from "@/views/messages/MessagesView.vue";

//定义路由关系
const routes = [
  { path: '/login', component: LoginVue },
  {
    path: '/', component: LayoutVue, redirect: '/index  ', children: [
      { path: '/index', component: AttendanceViewVue },
      { path: '/user/info', component: UserViewVue },
      { path: '/workbenches', component: WorkBenchesVue },
      { path: '/leave', component: LeaveViewVue },
      { path: '/attendancehistory', component: AttendanceHistoryViewVue },
      { path: '/expense', component: ExpenseViewVue },
      { path: '/notice', component: NoticeViewVue },
      { path: '/task', component: TaskViewVue },
      { path: '/messages', component: MessagesViewVue },
      { path: '/user/edit', component: UserEditVue }
    ]
  }
]
//创建路由实例
const router = createRouter({
  history: createWebHistory(),
  routes: routes
})
//导出路由
export default router